package cz.gelion.shylock.invoice.web.subj

import org.apache.wicket.markup.html.panel.Panel
import cz.gelion.shylock.invoice.Log
import org.apache.wicket.model.IModel
import cz.gelion.shylock.invoice.entity.Account
import cz.gelion.shylock.invoice.web.comp.TaForm
import org.apache.wicket.model.CompoundPropertyModel
import org.apache.wicket.markup.html.form.TextField
import org.apache.wicket.markup.html.form.TextArea
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink
import org.apache.wicket.ajax.AjaxRequestTarget
import org.apache.wicket.markup.html.form.Form

class AccountEditorPanel(id:String, model:IModel[Account]) extends Panel(id,model) with Log {

  log.trace("this(" + id + "," + model + ")")
  
  
  val form = new TaForm[Account]("form", new CompoundPropertyModel(model))
  add(form)
  
  form.add(new TextField("accountNo"))
  form.add(new TextArea("note"))
  
  form.add(new AjaxSubmitLink("link.ok") {
	 override def onSubmit(target:AjaxRequestTarget, form:Form[_]) {
	   log.trace("AjaxSubmitLink[link.ok].onSubmit")
	   //TODO
	 } 
	  override def onError(target:AjaxRequestTarget, form:Form[_]) {
	   log.trace("AjaxSubmitLink[link.ok].onError")
	   //TODO
	 } 
  });
  
  
}